#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;

class Solution
{
public:
    bool canPermutePalindrome(string s)
    {
        int hash[128] = { 0 };
        for (int i = 0; i < s.size(); i++) hash[s[i]]++;

        int count = 0;
        for (int i = 0; i < 128; i++) if (hash[i] % 2 == 1) count++;

        if (count <= 1) return true;
        return false;
    }
};

class Solution {
public:
    vector<int> subSort(vector<int>& array) {
        vector<int> tmp(array.begin(), array.end());
        sort(tmp.begin(), tmp.end());
        int n = array.size();

        int left = 0;
        while (left < n && tmp[left] == array[left])
        {
            left++;
        }

        int right = n - 1;
        while (right >= 0 && tmp[right] == array[right])
        {
            right--;
        }
        if (left >= right) return { -1, -1 };
        return { left, right };
    }
};